package com.cloud.es;

import org.apache.http.HttpHost;
import org.elasticsearch.client.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ElasticsearchConfiguration {

    @Value("${spring.data.elasticsearch.host}")
    private String HOST;

    @Value("${spring.data.elasticsearch.port}")
    private String PORT;

    @Bean
    public RestHighLevelClient getClient(){
        return new RestHighLevelClient(RestClient.builder(new HttpHost(HOST, Integer.valueOf(PORT))));
    }

}
